Updated to work with the current rails41 branch

Dominik Sander 11 years ago
parent
commit
76eb880828

+ 0 - 4
Gemfile

@@ -63,7 +63,3 @@ group :development, :test do
63 63
   gem 'webmock', require: false
64 64
   gem 'coveralls', require: false
65 65
 end
66
-
67
-group :production do
68
-  gem 'unicorn'
69
-end

+ 0 - 7
Gemfile.lock

@@ -142,7 +142,6 @@ GEM
142 142
     kaminari (0.14.1)
143 143
       actionpack (>= 3.0.0)
144 144
       activesupport (>= 3.0.0)
145
-    kgio (2.9.2)
146 145
     kramdown (1.1.0)
147 146
     libv8 (3.16.14.3)
148 147
     macaddr (1.7.1)
@@ -196,7 +195,6 @@ GEM
196 195
       rake (>= 0.8.7)
197 196
       rdoc (~> 3.4)
198 197
       thor (>= 0.14.6, < 2.0)
199
-    raindrops (0.13.0)
200 198
     rake (10.2.2)
201 199
     rdoc (3.12.2)
202 200
       json (~> 1.4)
@@ -285,10 +283,6 @@ GEM
285 283
     uglifier (2.5.0)
286 284
       execjs (>= 0.3.0)
287 285
       json (>= 1.8.0)
288
-    unicorn (4.8.2)
289
-      kgio (~> 2.6)
290
-      rack
291
-      raindrops (~> 0.7)
292 286
     uuid (2.3.7)
293 287
       macaddr (~> 1.0)
294 288
     warden (1.2.3)
@@ -351,7 +345,6 @@ DEPENDENCIES
351 345
   twitter-stream!
352 346
   typhoeus (~> 0.6.3)
353 347
   uglifier (>= 1.0.3)
354
-  unicorn
355 348
   webmock
356 349
   weibo_2 (~> 0.1.4)
357 350
   wunderground (~> 1.1.0)

+ 4 - 4
deployment/site-cookbooks/huginn_production/files/default/Procfile

@@ -1,4 +1,4 @@
1
-web: sudo bundle exec unicorn_rails -c config/unicorn.rb
2
-schedule: sudo bundle exec rails runner bin/schedule.rb
3
-twitter: sudo bundle exec rails runner bin/twitter_stream.rb
4
-dj: sudo bundle exec script/delayed_job run
1
+web: sudo bundle exec unicorn_rails -c config/unicorn.rb -E production
2
+schedule: sudo RAILS_ENV=production bundle exec rails runner bin/schedule.rb
3
+twitter: sudo RAILS_ENV=production bundle exec rails runner bin/twitter_stream.rb
4
+dj: sudo RAILS_ENV=production bundle exec script/delayed_job run

+ 1 - 0
deployment/site-cookbooks/huginn_production/files/default/env.example

@@ -23,6 +23,7 @@ DATABASE_PASSWORD=password
23 23
 
24 24
 # Configure Rails environment.  This should only be needed in production and may cause errors in development.
25 25
 RAILS_ENV=production
26
+FORCE_SSL=false
26 27
 
27 28
 # Outgoing email settings.  To use Gmail or Google Apps, put your Google Apps domain or gmail.com
28 29
 # as the SMTP_DOMAIN and your Gmail username and password as the SMTP_USER_NAME and SMTP_PASSWORD.

+ 5 - 6
deployment/site-cookbooks/huginn_production/files/default/nginx.conf

@@ -1,15 +1,18 @@
1 1
 #worker_process 2;
2 2
 user huginn huginn;
3 3
 
4
-events { 
4
+events {
5 5
   worker_connections 1024;
6 6
   accept_mutex on;
7 7
 }
8 8
 
9 9
 http {
10
+  types_hash_max_size 2048;
11
+  include    mime.types;
12
+
10 13
   upstream huginn_server {
11 14
     server unix:/home/huginn/shared/tmp/sockets/unicorn.sock;
12
-}
15
+  }
13 16
 
14 17
   server {
15 18
     listen 80;
@@ -23,13 +26,9 @@ http {
23 26
     }
24 27
     location @app {
25 28
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
26
-
27 29
       proxy_set_header X-Forwarded-Proto $scheme;
28
-
29 30
       proxy_set_header Host $http_host;
30
-
31 31
       proxy_redirect off;
32
-
33 32
       proxy_pass http://huginn_server;
34 33
     }
35 34
 }

+ 7 - 5
deployment/site-cookbooks/huginn_production/recipes/default.rb

@@ -14,7 +14,7 @@ group "huginn" do
14 14
   members ["huginn"]
15 15
 end
16 16
 
17
-%w("ruby1.9.1" "ruby1.9.1-dev" "libxslt-dev" "libxml2-dev" "curl" "libshadow-ruby1.8" "libmysqlclient-dev" "libffi-dev", "libssl-dev").each do |pkg|
17
+%w("ruby1.9.1" "ruby1.9.1-dev" "libxslt-dev" "libxml2-dev" "curl" "libshadow-ruby1.8" "libmysqlclient-dev" "libffi-dev" "libssl-dev").each do |pkg|
18 18
   package("#{pkg}")
19 19
 end
20 20
 
@@ -36,6 +36,7 @@ end
36 36
 
37 37
 deploy "/home/huginn" do
38 38
   repo "https://github.com/cantino/huginn.git"
39
+  branch "master"
39 40
   user "huginn"
40 41
   group "huginn"
41 42
   environment "RAILS_ENV" => "production"
@@ -81,12 +82,13 @@ deploy "/home/huginn" do
81 82
       ln -nfs /home/huginn/shared/config/.env ./.env
82 83
       ln -nfs /home/huginn/shared/config/unicorn.rb ./config/unicorn.rb
83 84
       sudo cp /home/huginn/shared/config/nginx.conf /etc/nginx/
85
+      echo 'gem "unicorn", :group => :production' >> Gemfile
84 86
       sudo bundle install --without=development --without=test
85 87
       sed -i s/REPLACE_ME_NOW\!/$(sudo bundle exec rake secret)/ .env
86
-      sed -i s/config\.force_ssl\ \=\ true/config\.force_ssl\ \=\ false/ config/environments/production.rb
87
-      sudo bundle exec rake db:create
88
-      sudo bundle exec rake db:migrate
89
-      sudo bundle exec rake db:seed
88
+      sudo RAILS_ENV=production bundle exec rake db:create
89
+      sudo RAILS_ENV=production bundle exec rake db:migrate
90
+      sudo RAILS_ENV=production bundle exec rake db:seed
91
+      sudo RAILS_ENV=production bundle exec rake assets:precompile
90 92
       sudo foreman export upstart /etc/init -a huginn -u huginn -l log
91 93
       sudo start huginn
92 94
       EOH